home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / progs / thor / unix / grab.oslonett < prev   
Text File  |  1996-11-10  |  3KB  |  90 lines

  1. #!/bin/sh
  2. # $Id: grab.oslonett 1.1 1996/07/18 04:12:16 pettern Exp pettern $
  3. ##########################################################################
  4. #     UQWK_SOUP grab script v0.95 for THOR.  Author: Kjell Irgens.       #
  5. # Should be safe to use, but I take *no* responsibilities for lost mail. #
  6. # grab -h for help.                                                      #
  7. # This version will export the active file, for non-standard setups.     #
  8. ##########################################################################
  9.  
  10. grab=soup                  # modify if the grab in THOR name is not "soup"
  11. wdir=soup                  # name of work directory (UN*X side)
  12.  
  13.        UQ_HOME_DIR=. UQ_DO_NEWS=1 UQ_SOUP_MODE=1 UQ_NRC_FILE=$HOME/.newsrc UQ_ACT_FILE="/local/news/active"
  14. export UQ_HOME_DIR   UQ_DO_NEWS   UQ_SOUP_MODE   UQ_NRC_FILE   UQ_ACT_FILE
  15.  
  16. repliesfile=$grab\.out
  17. grabfile=$grab`date +%H%M%S`.zip
  18.  
  19. mkdir 2>/dev/null $HOME/$wdir
  20. cd $HOME/$wdir
  21.  
  22. no_rz=false no_sz=false restore=false UQ_DO_MAIL=1
  23.  
  24. for i in $*
  25. do
  26.   case $i in
  27.   -r ) no_rz=true ;;
  28.   -s ) no_sz=true ;;
  29.   -n ) UQ_DO_NEWS=0 ; export UQ_DO_NEWS ;;
  30.   -m ) UQ_DO_MAIL=0 ; export UQ_DO_MAIL ;;
  31.   -u ) UQ_MAX_BLKS=0 ; export UQ_MAX_BLKS;;
  32.   -x ) if [ -r .mail_backup ]
  33.        then echo "Restoring mail..."
  34.        else echo "No mail to restore"
  35.        fi
  36.        cat 2>/dev/null .mail_backup >>$MAIL && rm 2>/dev/null .mail_backup
  37.        restore=true;;
  38.   -z ) if [ -r .newsrc_backup ]
  39.        then echo "Restoring news..."
  40.        else echo "No news to restore"
  41.        fi
  42.        mv 2>/dev/null .newsrc_backup $UQ_NRC_FILE
  43.        restore=true;;
  44.   *  )
  45.        echo "Usage: $0 [option] ..."
  46.        echo "[-r]  no rz";echo "[-s]  no sz";echo "[-n]  don't grab news"
  47.        echo "[-m]  don't grab mail";echo "[-u]  unlimited grab size"
  48.        echo "[-x]  restore mail";echo "[-z]  restore news"
  49.        echo "[-h]  this text"
  50.        exit 0 ;;
  51.   esac
  52. done
  53.  
  54. if [ $restore = true ]
  55. then exit 0
  56. fi
  57.  
  58. # backups never hurt anyone
  59. if [ $UQ_DO_MAIL = 1 ]
  60. then cp 2>/dev/null $MAIL .mail_backup
  61. fi
  62. if [ $UQ_DO_NEWS = 1 ]
  63. then cp 2>/dev/null $UQ_NRC_FILE .newsrc_backup
  64. fi
  65.  
  66.  
  67. if [ $no_rz = false ]
  68. then rz
  69. fi
  70.  
  71. if [ -r $repliesfile ]
  72. then unzip -U $repliesfile
  73. fi
  74.  
  75. if [ -r REPLIES ]
  76. then /local/bin/uqwk18.exe -RREPLIES
  77. else /local/bin/uqwk18.exe
  78. fi
  79.  
  80. rm 2>/dev/null $repliesfile
  81.  
  82. if [ -r AREAS ]
  83. then
  84.   zip -m $grabfile AREAS *.MSG
  85.   if [ $no_sz = false ]           # assumes you use zmodem, you could also
  86.   then                            # use: kermit -i -s $grabfile && ...
  87.     sz -br $grabfile && rm $grabfile
  88.   fi
  89. fi
  90.